<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:sec="http://www.springframework.org/security/facelets/tags">

<h:head>
    <title>Avaliação InfNet</title>
    <meta http-equiv="content-type" content="text/xhtml; charset=UTF-8" />
</h:head>

<body >
	<p:panel header="Sistema InfNet"
		footer="InfNet 2013" >
		
		<h:form>
			<p:menubar>
				<p:submenu label="Cadastro" icon="ui-icon ui-icon-document" rendered="#{sec:ifAnyGranted('ROLE_ADMIN,ROLE_USER')}"  >
					<p:menuitem value="Usuário" outcome="/private/cadastroUsuario.xhtml" rendered="#{sec:ifAnyGranted('ROLE_ADMIN')}" /> 
					<p:menuitem value="Avaliação" rendered="#{sec:ifAnyGranted('ROLE_ADMIN')}" /> 
					<p:menuitem value="Permissão" rendered="#{sec:ifAnyGranted('ROLE_ADMIN')}" /> 
				</p:submenu>
				<p:submenu label="Relatório" icon="ui-icon ui-icon-document" rendered="#{sec:ifAnyGranted('ROLE_ADMIN,ROLE_USER')}">
					 <p:menuitem value="Usuário" outcome="/private/listaUsuarios.xhtml" rendered="#{sec:ifAnyGranted('ROLE_ADMIN,ROLS_USER')}" /> 
					<p:menuitem value="Avaliação" outcome="/private/avaliacao.xhtml" rendered="#{sec:ifAnyGranted('ROLE_ADMIN,ROLE_USER')}"/>
				</p:submenu>
			</p:menubar>
			</h:form>
			
			<h:form> 
            <p:dataTable value="#{usuarioBean.listaUsuario}" var="usuario">
            <f:facet name="header">  
            Lista de usuários
             </f:facet>  
						<p:column headerText="Nome">  
							<h:outputText value="#{usuario.nome}" />
						</p:column>
 
						<p:column headerText="Usuário">
							<h:outputText value="#{usuario.username}" />
						</p:column>
						
						<p:column headerText="Email">
							<h:outputText value="#{usuario.email}" />
						</p:column>
						
						<p:column headerText="CPF">
							<h:outputText value="#{usuario.cpf}" />
						</p:column>
						
						<p:column headerText="RG">
							<h:outputText value="#{usuario.rg}" />
						</p:column>
						
						<p:column headerText="Data Cadastro">
							<h:outputText value="#{usuario.dataCadastro}" />
						</p:column>
 
						<p:column headerText="Opções">
 
							<h:commandLink value="Editar" action="editar">
						
							</h:commandLink>
 
							<h:commandLink value="Excluir" action="#{usuarioBean.remove}">
						
							</h:commandLink>
						</p:column>
						
						   <f:facet name="footer">  
				            InfNet
				        </f:facet>  
  
					</p:dataTable>
					</h:form>
			
             <br /><br />
			<h:form>
	 <p:commandButton type="submit"  style="float:right" value="Sair" action="#{loginBean.logout}" />
		</h:form>
		<br /><br />
	</p:panel>

</body>
</html>

